﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="AlunosCadastrados.aspx.cs" Inherits="RepositorioDeMonografia.AlunosCadastrados" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
 <fieldset class="CadastraCurso">
        <legend>&nbsp;Alunos Cadastrados</legend>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" CellPadding="0" 
        DataSourceID="SqlDataSourceAlunosCadastrados" ForeColor="#333333" 
                GridLines="None" DataKeyNames="Matricula" PageSize="5" Width="777px">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField DataField="Matricula" HeaderText="Matricula" 
                        SortExpression="Matricula" InsertVisible="False" ReadOnly="True" />
                    <asp:BoundField DataField="Nome" HeaderText="Nome" 
                        SortExpression="Nome" />
                    <asp:TemplateField HeaderText="Curso" SortExpression="Id_Curso">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Id_Curso") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Id_Curso") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="Telefone" HeaderText="Telefone" 
                        SortExpression="Telefone" />
                    <asp:BoundField DataField="Email" HeaderText="Email" 
                        SortExpression="Email" />
                    <asp:BoundField DataField="Celular" HeaderText="Celular" 
                        SortExpression="Celular" />
                    <asp:BoundField DataField="Endereco" HeaderText="Endereco" 
                        SortExpression="Endereco" />
                    <asp:TemplateField HeaderText="Orientador" SortExpression="Id_Orientador">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Id_Orientador") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("Id_Orientador") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Monografia" SortExpression="Id_Monografia">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Id_Monografia") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label3" runat="server" Text='<%# Bind("Id_Monografia") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:CommandField ButtonType="Button" CancelText="Cancelar" 
                        DeleteText="Deletar" EditText="Editar" InsertText="Cadastrar" NewText="Novo" 
                        SelectText="Selecionar" ShowDeleteButton="True" ShowEditButton="True" 
                        ShowSelectButton="True" UpdateText="Atualizar" />
                </Columns>
                
                               
            </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSourceAlunosCadastrados" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            
            SelectCommand="SELECT [Matricula], [Nome], [Id_Curso], [Endereco], [Telefone], [Email], [Celular], [Id_Orientador], [Id_Monografia] FROM [Aluno]" 
            ConflictDetection="CompareAllValues" 
            DeleteCommand="DELETE FROM [Aluno] WHERE [Matricula] = @original_Matricula AND (([Nome] = @original_Nome) OR ([Nome] IS NULL AND @original_Nome IS NULL)) AND (([Id_Curso] = @original_Id_Curso) OR ([Id_Curso] IS NULL AND @original_Id_Curso IS NULL)) AND (([Endereco] = @original_Endereco) OR ([Endereco] IS NULL AND @original_Endereco IS NULL)) AND (([Telefone] = @original_Telefone) OR ([Telefone] IS NULL AND @original_Telefone IS NULL)) AND (([Email] = @original_Email) OR ([Email] IS NULL AND @original_Email IS NULL)) AND (([Celular] = @original_Celular) OR ([Celular] IS NULL AND @original_Celular IS NULL)) AND (([Id_Orientador] = @original_Id_Orientador) OR ([Id_Orientador] IS NULL AND @original_Id_Orientador IS NULL)) AND (([Id_Monografia] = @original_Id_Monografia) OR ([Id_Monografia] IS NULL AND @original_Id_Monografia IS NULL))" 
            InsertCommand="INSERT INTO [Aluno] ([Nome], [Id_Curso], [Endereco], [Telefone], [Email], [Celular], [Id_Orientador], [Id_Monografia]) VALUES (@Nome, @Id_Curso, @Endereco, @Telefone, @Email, @Celular, @Id_Orientador, @Id_Monografia)" 
            OldValuesParameterFormatString="original_{0}" 
            UpdateCommand="UPDATE [Aluno] SET [Nome] = @Nome, [Id_Curso] = @Id_Curso, [Endereco] = @Endereco, [Telefone] = @Telefone, [Email] = @Email, [Celular] = @Celular, [Id_Orientador] = @Id_Orientador, [Id_Monografia] = @Id_Monografia WHERE [Matricula] = @original_Matricula AND (([Nome] = @original_Nome) OR ([Nome] IS NULL AND @original_Nome IS NULL)) AND (([Id_Curso] = @original_Id_Curso) OR ([Id_Curso] IS NULL AND @original_Id_Curso IS NULL)) AND (([Endereco] = @original_Endereco) OR ([Endereco] IS NULL AND @original_Endereco IS NULL)) AND (([Telefone] = @original_Telefone) OR ([Telefone] IS NULL AND @original_Telefone IS NULL)) AND (([Email] = @original_Email) OR ([Email] IS NULL AND @original_Email IS NULL)) AND (([Celular] = @original_Celular) OR ([Celular] IS NULL AND @original_Celular IS NULL)) AND (([Id_Orientador] = @original_Id_Orientador) OR ([Id_Orientador] IS NULL AND @original_Id_Orientador IS NULL)) AND (([Id_Monografia] = @original_Id_Monografia) OR ([Id_Monografia] IS NULL AND @original_Id_Monografia IS NULL))">
            <DeleteParameters>
                <asp:Parameter Name="original_Matricula" Type="Int32" />
                <asp:Parameter Name="original_Nome" Type="String" />
                <asp:Parameter Name="original_Id_Curso" Type="Int32" />
                <asp:Parameter Name="original_Endereco" Type="String" />
                <asp:Parameter Name="original_Telefone" Type="String" />
                <asp:Parameter Name="original_Email" Type="String" />
                <asp:Parameter Name="original_Celular" Type="String" />
                <asp:Parameter Name="original_Id_Orientador" Type="Int32" />
                <asp:Parameter Name="original_Id_Monografia" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="Nome" Type="String" />
                <asp:Parameter Name="Id_Curso" Type="Int32" />
                <asp:Parameter Name="Endereco" Type="String" />
                <asp:Parameter Name="Telefone" Type="String" />
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Celular" Type="String" />
                <asp:Parameter Name="Id_Orientador" Type="Int32" />
                <asp:Parameter Name="Id_Monografia" Type="Int32" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Nome" Type="String" />
                <asp:Parameter Name="Id_Curso" Type="Int32" />
                <asp:Parameter Name="Endereco" Type="String" />
                <asp:Parameter Name="Telefone" Type="String" />
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Celular" Type="String" />
                <asp:Parameter Name="Id_Orientador" Type="Int32" />
                <asp:Parameter Name="Id_Monografia" Type="Int32" />
                <asp:Parameter Name="original_Matricula" Type="Int32" />
                <asp:Parameter Name="original_Nome" Type="String" />
                <asp:Parameter Name="original_Id_Curso" Type="Int32" />
                <asp:Parameter Name="original_Endereco" Type="String" />
                <asp:Parameter Name="original_Telefone" Type="String" />
                <asp:Parameter Name="original_Email" Type="String" />
                <asp:Parameter Name="original_Celular" Type="String" />
                <asp:Parameter Name="original_Id_Orientador" Type="Int32" />
                <asp:Parameter Name="original_Id_Monografia" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </fieldset>
</asp:Content>
